<?php

use App\Http\Controllers\FileController;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group([
    'middleware' => 'logaccess',
], function () {
    Route::get('/', function () {
        return response()->json([
            'status' => 'alive',
            'version' => '1.0.0',
        ]);
    });

    Route::get('/invites', [\App\Http\Controllers\InviteController::class, 'index'])->name('invite');

    Route::any('/payment/kylin/transfer', [\App\Http\Controllers\PaymentKylinController::class, 'transfer']);
    Route::any('/payment/kylin/direct-transfer', [\App\Http\Controllers\PaymentKylinController::class, 'directTransfer']);
    Route::any('/payment/kylin/invoke', [\App\Http\Controllers\PaymentKylinController::class, 'invoke']);

    Route::any('/payment/wechat/paid-callback', [\App\Http\Controllers\PaymentWechatController::class, 'paidCallback']);
    Route::any('/payment/wechat/transfer-callback', [\App\Http\Controllers\PaymentWechatController::class, 'transferCallback']);

    Route::any('/filebase/upload', [FileController::class, 'handle']);

    Route::any('wechat', [\App\Http\Controllers\WechatController::class, 'serve']);


    Route::group(['middleware' => ['web', 'wechat.oauth']], function () {
        Route::get('/wechat/userinfo', [\App\Http\Controllers\WechatController::class, 'userinfo']);
    });


    Route::get('/agreement', [\App\Http\Controllers\PolicyController::class, 'agreement']);
    Route::get('/privicy', [\App\Http\Controllers\PolicyController::class, 'privicy']);
});
